//
//  UIColor+random.m
//  2202-Lottery_TabBar
//
//  Created by 李少葵 on 7/1/16.
//  Copyright © 2016年 myClassroom. All rights reserved.
//

#import "UIColor+random.h"

@implementation UIColor (random)


#pragma mark - randomColor
+ (UIColor *)randomColor {
    CGFloat hue = ( arc4random() % 256 / 256.0 - 0.2);  //  0.0 to 1.0
    CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.3;  //  0.5 to 1.0, away from white
    CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.3;  //  0.5 to 1.0, away from black
    return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1];
}
#pragma mark - RGB
+ (UIColor *)randomColorWithRGB {
    
    CGFloat red =    ( arc4random() % 256 / 256.0);  //  0.0 to 1.0
    CGFloat green =  ( arc4random() % 128 / 256.0 ) + 0.3;  //  0.5 to 1.0, away from white
    CGFloat blue =   ( arc4random() % 128 / 256.0 ) + 0.3;  //  0.5 to 1.0, away from black
    CGFloat alpha =  ( arc4random() % 256 / 256.0)+ 0.3;
    
    return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
}



@end
